
% A2b_format_full_adj
%==========================================================================

% Description: This code cleans and formats the data for the entry case and
% removes outliers

load('P_summary_full_adj.mat');

P_summary = P_summary(P_summary.mc_flag == 1, :);
P_summary = P_summary(abs(P_summary.beta_price_80) > 0.6, :);
P_summary = P_summary(abs(P_summary.beta_price_20) > 0.6, :);
P_summary = P_summary(P_summary.P_true_k_sorted_20 ~= Inf, :);
P_summary = P_summary(P_summary.P_true_k_sorted_80 ~= Inf, :);
P_summary = P_summary(P_summary.P_counter_k_sorted_20 ~= Inf, :);
P_summary = P_summary(P_summary.P_counter_k_sorted_80 ~= Inf, :);
P_summary = P_summary(imag(P_summary.P_true_k_sorted_20) == 0, :); 
P_summary = P_summary(imag(P_summary.P_true_k_sorted_80) == 0, :); 
P_summary = P_summary(imag(P_summary.P_counter_k_sorted_20) == 0, :); 
P_summary = P_summary(imag(P_summary.P_counter_k_sorted_80) == 0, :); 

P_summary.diff = P_summary.P_counter_k_sorted_20 ./ P_summary.P_true_k_sorted_20 - P_summary.P_counter_k_sorted_80 ./ P_summary.P_true_k_sorted_80;     
P_summary = P_summary(abs(P_summary.diff) < 1, :);

P_summary.mc_flag = [];
P_summary.price = [];
P_summary.diff = [];

writetable(P_summary, 'P_summary_full_adj_format.csv', 'Delimiter',',','QuoteStrings',true);

